<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="/WEB-INF/template/template.xhtml">

	<ui:define name="content">
		<f:loadBundle basename="languageSettings/language" var="msg" />
		<f:view>
			<h:form>
				<br />

				<div class="middle">
					<h2>Create user</h2>
				</div>
				<br />
				<h:messages class="myError"></h:messages>

				<h:panelGrid class="panelGrid" columns="2">
					<h:outputText value="#{msg.AD_createUser_domain}"></h:outputText>
					<h:selectOneMenu id="selectDomain" value="#{ub.domain}">
						<f:selectItems value="#{ub.domains}"></f:selectItems>
					</h:selectOneMenu>
					<h:outputText value="#{msg.AD_createUser_usertype}"></h:outputText>
					<h:selectOneMenu id="selectUstype" value="#{ub.ustype}">
						<f:selectItems value="#{ub.ustypes}"></f:selectItems>
					</h:selectOneMenu>
					<h:outputText value="#{msg.AD_createUser_name}"></h:outputText>
					<h:inputText value="#{ub.name}" label="Name required"
						required="true">
						<f:ajax render="email username" event="keyup"></f:ajax>
					</h:inputText>
					<h:outputText value="#{msg.AD_createUser_email}"></h:outputText>
					<h:inputText id="email" value="#{ub.email}" label="Email"
						required="true" requiredMessage="#{msg.AD_createUser_required1}">
						<f:validator validatorId="validators.EmailValidator"></f:validator>
						<f:validator validatorId="validators.EmailDuplicateValidator"></f:validator>
					</h:inputText>
					<h:outputText value="#{msg.AD_createUser_username}"></h:outputText>
					<h:inputText id="username" value="#{ub.username}"
						label="Username required" required="true"
						requiredMessage="#{msg.AD_createUser_required2}">
						<f:validator validatorId="validators.UsernameValidator"></f:validator>
					</h:inputText>
				</h:panelGrid>
				<br />
				<div class="middle">
					<h:commandButton class="button"
						value="#{msg.AD_createUser_adduser}"
						onclick="#{msg.AD_createUser_confirmMessage}"
						actionListener="#{ub.addUser}"></h:commandButton>
					<br />
					<h:commandButton class="button" value="Cancel"
						actionListener="#{ub.goBack}" immediate="true"></h:commandButton>
				</div>



			</h:form>
		</f:view>
	</ui:define>

</ui:composition>
</html>